﻿using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Data.Entity;
using Newtonsoft.Json;
using System.Data.Entity.Infrastructure;
using _24_Hour_Blogger.Models;
using _24_Hour_Blogger.Models.Repository;
using _24_Hour_Blogger.Library;

namespace _24_Hour_Blogger.ViewModels.Repository
{
    public partial class RepositoryArticleMediaViewModel : ViewModelBase<RepositoryArticleMedia>
    {

        public RepositoryArticleMediaViewModel()
        {
            this.Entity = new RepositoryArticleMedia();
        }

        DbContext dataContext = null;
        DbSet<RepositoryArticleMedia> entitiesCollection = null;
        RepositoryArticleMedia entityClass = null;
        public RepositoryArticleMediaViewModel(DbContext dataContext, DbSet<RepositoryArticleMedia> entitiesCollection, RepositoryArticleMedia entityClass)
        {

            this.dataContext = dataContext;
            this.entitiesCollection = entitiesCollection;
            this.entityClass = entityClass;
            if (this.entityClass == null)
            {
                this.entityClass = new RepositoryArticleMedia();
            }
            this.Entity = this.entityClass;
        }

        public override Int32 Id
        {
            get
            {
                return Entity.ArticleMediaId;
            }
            set
            {

                Entity.ArticleMediaId = value;


            }
        }

        public Int32 RepositoryArticleMediaId
        {
            get
            {
                return Entity.ArticleMediaId;
            }
            set
            {
                if (value > 0)

                    if (Entity.ArticleMediaId != value)
                    {
                        Entity.ArticleMediaId = value;
                        this.IsDirty = true;
                    }
            }
        }

        public byte[] Data
        {
            get
            {
                return Entity.Data;
            }
            set
            {
                if (Entity.Data != value)
                {
                    Entity.Data = value;
                    this.IsDirty = true;
                }
            }
        }

        public byte[] ThumbnailData
        {
            get
            {
                return Entity.ThumbnailData;
            }
            set
            {
                if (Entity.ThumbnailData != value)
                {
                    Entity.ThumbnailData = value;
                    this.IsDirty = true;
                }
            }
        }
        
        public byte[] CropData
        {
            get
            {
                return Entity.CropData;
            }
            set
            {
                if (Entity.CropData != value)
                {
                    Entity.CropData = value;
                    this.IsDirty = true;
                }
            }
        }

        public override DateTime CreatedDate
        {
            get
            {
                return Entity.CreatedDate.Value;
            }
            set
            {
                if (Entity.CreatedDate != value)
                {
                    Entity.CreatedDate = value;
                    this.IsDirty = true;
                }
            }
        }

        public override DateTime UpdatedDate
        {
            get
            {
                return Entity.UpdatedDate.Value;
            }
            set
            {
                if (Entity.UpdatedDate != value)
                {
                    Entity.UpdatedDate = value;
                    this.IsDirty = true;
                }
            }
        }

        public override Int32 CreatedByUserId
        {
            get
            {
                return Entity.CreatedByUserId.Value;
            }
            set
            {
                if (Entity.CreatedByUserId != value)
                {
                    Entity.CreatedByUserId = value;
                    this.IsDirty = true;
                }
            }
        }

        public override Int32 UpdatedByUserId
        {
            get
            {
                return Entity.UpdatedByUserId.Value;
            }
            set
            {
                if (Entity.UpdatedByUserId != value)
                {
                    Entity.UpdatedByUserId = value;
                    this.IsDirty = true;
                }
            }
        }

        public Guid Identifier
        {
            get
            {
                return Entity.Identifier;
            }
            set
            {
                if (Entity.Identifier != value)
                {
                    Entity.Identifier = value;
                    this.IsDirty = true;
                }
            }
        }
    }
}